package main

import (
	"fmt"
	"github.com/gomodule/redigo/redis"
)

func main() {
	conn, _ := redis.Dial("tcp", "localhost:6379")
	defer conn.Close()
	//redis事务（没有原子性）
	conn.Send("multi")        //开启事务
	conn.Send("incr", "foo")  //执行命令
	conn.Send("incr", "bar")  //执行命令
	r, err := conn.Do("exec") //提交事务
	fmt.Println(r, err)

}
